package mystruts;

import com.opensymphony.xwork2.ActionSupport;

public class TestAction extends ActionSupport{

	String username;
	String password;
	String mes;
	String nextPage="";
	
	public String execute() throws Exception {
		
		this.LOG.debug("Hello1");
		this.LOG.info("Hello1");
		this.LOG.info(this.getUsername(), this.getPassword());
		
		System.out.println("TextAction.execute....");
		System.out.println("username : "+ this.getUsername());
		System.out.println("password : "+ this.getPassword());
		
		if(this.getUsername()==null && this.getPassword()==null){
			this.setMes("第一次近來歡迎歡迎");
			nextPage = "testlogin";
		}else if("tom".equals(this.getUsername()) && "1234".equals(this.getPassword())){
			this.setMes("輸入帳密成功喔!");
			nextPage = "success";
		}else{
			this.setMes("失敗了!");
			nextPage = "testlogin";
		}
        return SUCCESS;
    }

	public String getMes() {
		return mes;
	}
	public void setMes(String mes) {
		this.mes = mes;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
}
